<?
$smarty=new Smarty();
if(!ANTIHACK) die("ANTIHACK...");
//$sel=query("select * from quangcao where position=7 order by sort asc");
//$data=array();
/*
if($fsel=fetch($sel))
{
	$decode=json_decode($fsel[content],true);
	$data[0]["url"]=$decode[1][0];
	$data[1]["url"]=$decode[1][2];
	$data[0]["img"]=$decode[0][0];
	$data[1]["img"]=$decode[0][2];
	$active=$fsel["is_active"];
}*/
$sel=query("select * from quangcao where position=7 and is_active=1 order by sort asc");
$i=0;
$data=array();
while($fsel=fetch($sel))
{
	$fsel['count']=$i;
	$getqc=query("select * from link_quangcao where parent=".$fsel['id']);
	$img=array();
	$url=array();
	while($fgetqc=fetch($getqc))
	{
		$img[]=$fgetqc['img'];
		$url[]=baselink.'/clickads.php?id='.$fgetqc['id'].'&url='.$fgetqc['url'];
	}
	$fsel[img]=$img;
	$fsel[url]=$url;
	$data[]=$fsel;
	$i++;
}
$smarty->assign("qc_datal",$data);
$sel=query("select * from quangcao where position=8 and is_active=1 order by sort asc");
$i=0;
$data=array();
while($fsel=fetch($sel))
{
	$fsel['count']=$i;
	$getqc=query("select * from link_quangcao where parent=".$fsel['id']);
	$img=array();
	$url=array();
	while($fgetqc=fetch($getqc))
	{
		$img[]=$fgetqc['img'];
		$url[]=baselink.'/clickads.php?id='.$fgetqc['id'].'&url='.$fgetqc['url'];
	}
	$fsel[img]=$img;
	$fsel[url]=$url;
	$data[]=$fsel;
	$i++;
}
$smarty->assign("qc_datar",$data);
$smarty->assign("show",1);
$smarty->display("adssuon.htm");